package com.company.managesystem.activity;

import android.os.Bundle;
import android.view.View;
import android.widget.Button;
import android.widget.TextView;
import android.widget.Toast;

import com.company.managesystem.R;
import com.company.managesystem.util.SharePreferenceUtil;

/**
 * 已完成工单详情
 * Created by lqy on 2017/6/30.
 */

public class FinishedActivity extends BaseActivity {
    private static String TAG = "FinishedActivity";
    private TextView workOrderText, contentText, addressText, bxtimeText, departmentText, bxnameText, jdtimeText, wctimeText, wxnameText;
    private Button finishedButton;
    private String workOrder, content, address, bxtime, department, bxname, jdtime, wctime, wxname, status;

    @Override
    protected void loadViewLayout() {
        setContentView(R.layout.activity_finished);
        workOrderText = (TextView) findViewById(R.id.finished_code);
        contentText = (TextView) findViewById(R.id.finished_content);
        addressText = (TextView) findViewById(R.id.finished_address);
        bxtimeText = (TextView) findViewById(R.id.finished_bxtime);
        departmentText = (TextView) findViewById(R.id.finished_department);
        bxnameText = (TextView) findViewById(R.id.finished_bxname);
        jdtimeText = (TextView) findViewById(R.id.finished_jdtime);
        wctimeText = (TextView) findViewById(R.id.finished_wctime);
        wxnameText = (TextView) findViewById(R.id.finished_wxname);
        finishedButton = (Button) findViewById(R.id.finished_button);
    }

    @Override
    protected void initView() {
        setToolBarTitle("已完成工单详情");
        setToobarBackIcon(R.mipmap.ic_arrow_back);
    }

    @Override
    protected void initData() {
        wxname = new SharePreferenceUtil(this).getName();
        Bundle bundle = this.getIntent().getExtras();
        status = bundle.getString("status");
        if (status.equals("finished")) {
            workOrder = bundle.getString("finished_code");
            content = bundle.getString("finished_content");
            address = bundle.getString("finished_address");
            bxtime = bundle.getString("finished_bxtime");
            department = bundle.getString("finished_department");
            bxname = bundle.getString("finished_bxname");
            jdtime = bundle.getString("finished_jdtime");
            wctime = bundle.getString("finished_wctime");
            finishedButton.setOnClickListener(new View.OnClickListener() {
                @Override
                public void onClick(View view) {
                    Toast.makeText(FinishedActivity.this, "评价功能暂未开放，敬请期待！", Toast.LENGTH_SHORT).show();
                }
            });
        }
        workOrderText.setText(workOrder);
        contentText.setText(content);
        addressText.setText(address);
        bxtimeText.setText(bxtime);
        departmentText.setText(department);
        bxnameText.setText(bxname);
        jdtimeText.setText(jdtime);
        wctimeText.setText(wctime);
        wxnameText.setText(wxname);
    }

}
